<!DOCTYPE html>
<html>
Test passes if it does not crash.
<script>
if (window.testRunner)
    testRunner.dumpAsText();

var docElement = document.documentElement;
function crash() {
    iframe1 = document.createElementNS("http://www.w3.org/1999/xhtml", "iframe");
    iframe1.setAttribute("srcdoc", "ABC");
    docElement.appendChild(iframe1);
    document1 = document.implementation.createDocument("", null);
    iframe1.addEventListener("DOMFocusOut", function () { document1.adoptNode(iframe1); }, false);
    iframe1.focus();
    setTimeout("finish();", 0);
}

function finish() {
    document.designMode = "on";
    range1 = document.createRange();
    range1.selectNodeContents(iframe1.contentDocument);
    window.getSelection().addRange(range1);
}

document.addEventListener("DOMContentLoaded", crash, false);
</script>
</html>
